﻿@using Orchard.Azure.MediaServices.Models
@using Newtonsoft.Json
@{
    var cloudVideoPart = (CloudVideoPart)Model.ContentPart;
    var thumbnailAsset = cloudVideoPart.ThumbnailAsset;
    var defaultWidth = 600;
    var defaultHeight = 400;
    var backgroundColor = "#000";
    var posterImageUrl = thumbnailAsset != null ? thumbnailAsset.PrivateMainFileUrl : Url.Content("~/Modules/Microsoft.AzureMedia/Images/Thumbnail-Placeholder2.png");
    var tag = new TagBuilder("div");

    tag.Attributes["data-player-video-id"] = cloudVideoPart.Id.ToString();
    tag.Attributes["data-player-width"] = defaultWidth.ToString();
    tag.Attributes["data-player-height"] = defaultHeight.ToString();
    tag.Attributes["data-player-apply-media-queries"] = "true";
    tag.Attributes["data-player-auto-play"] = "true";
    tag.Attributes["style"] = String.Format("width: {0}px; height: {1}px; background: {2} url('{3}') center center; -webkit-background-size: cover; -moz-background-size: cover; -o-background-size: cover; background-size: cover;", defaultWidth, defaultHeight, backgroundColor, posterImageUrl);
}
@Html.Raw(tag.ToString(TagRenderMode.Normal))